home *** CD-ROM | disk | FTP | other *** search
/ Invisible Universe / Invisible Universe (1995)(Voyager)[Mac-PC].iso / mac / UNIVERSE / SHARED.DIR / 01012_Script_dmd macros < prev    next >
Text File  |  1995-11-21  |  24KB  |  1,076 lines

  1. --dmd
  2. on resetAll
  3.   put the freebytes
  4.   
  5.   set c = count(the windowList)
  6.   repeat with i = 1 to c
  7.     set w = getAt(the windowList, 1) -- keep trashing the first window
  8.     forget(w)
  9.   end repeat
  10.   
  11.   
  12.   clearGlobals
  13.   unloadCast 1,1000
  14.   if the machineType <> 256 then maxmem()
  15.   
  16.   put the freebytes
  17.   
  18. end
  19.  
  20. on showall
  21.   repeat with i = 1 to 48
  22.     set the visibility of sprite i = 1
  23.   end repeat
  24. end
  25.  
  26. on hideall48
  27.   repeat with i = 1 to 48
  28.     set the visibility of sprite i = 0
  29.   end repeat
  30. end
  31.  
  32. on dumpListContents
  33.   set fullList to value(field "O.DIR")
  34.   
  35.   repeat with i = 1 to count(fullList)
  36.     set el = getAt(fullList, i)
  37.     
  38.     put "Image: (" & string(getPropAt(fullList, i)) & ") " & getAt(el, 1)
  39.     
  40.     if count(el) > 2 then
  41.       set subList = getAt(el, 3)
  42.       
  43.       -- get VIEWS, PHOTOS, & HOTSPOTS
  44.       set VIEWS = getaProp(subList, #VIEWS)
  45.       if voidP(VIEWS) then
  46.         set vc = 0
  47.       else
  48.         set vc = count(VIEWS)
  49.       end if
  50.       
  51.       set PHOTOS = getaProp(subList, #PHOTOS)
  52.       if voidP(PHOTOS) then
  53.         set pc = 0
  54.       else
  55.         set pc = count(PHOTOS)
  56.       end if
  57.       
  58.       set HOTSPOTS = getaProp(subList, #HOTSPOTS)
  59.       if voidP(HOTSPOTS) then
  60.         set hc = 0
  61.       else
  62.         set hc = count(HOTSPOTS)
  63.       end if
  64.       
  65.     else
  66.       set vc = 0
  67.       set pc = 0
  68.       set hc = 0
  69.     end if
  70.     
  71.     
  72.     if vc > 1 then
  73.       repeat with j = 1 to vc
  74.         set v = getAt(VIEWS, j)
  75.         if v <> string(getPropAt(fullList, i)) then 
  76.           set subViewName = getAt(getaProp(fullList, v), 1)
  77.           put "  View: " & subViewName
  78.         end if
  79.         
  80.       end repeat
  81.     end if
  82.     
  83.     
  84.     if pc > 0 then
  85.       repeat with j = 1 to pc
  86.         set v = getAt(PHOTOS, j)
  87.         if v <> string(getPropAt(fullList, i)) then 
  88.           set subViewName = getAt(getaProp(fullList, v), 1)
  89.           put "  Photo: " & subViewName
  90.         end if
  91.         
  92.       end repeat      
  93.     end if
  94.     
  95.     if hc > 0 then
  96.       repeat with j = 1 to hc
  97.         set v = getAt(HOTSPOTS, j)
  98.         if v <> string(getPropAt(fullList, i)) then 
  99.           set subViewName = getAt(getaProp(fullList, v), 1)
  100.           put "  Hot spots: " & subViewName
  101.         end if
  102.         
  103.       end repeat      
  104.     end if
  105.     
  106.     
  107.     put ""
  108.     --if i = 40 then asdf
  109.   end repeat
  110.   
  111.   
  112. end dumpListContents
  113.  
  114.  
  115. on ScreenSaver
  116.   global gSS, gNavPalette, gCom 
  117.   global gNavOffScreen
  118.   
  119.   hideOverheadMenu
  120.   updateStage
  121.   
  122.   if not gNavOffScreen and not voidP(gNavPalette) then
  123.     tell gNavPalette to lCloseNavPalette(1) -- will also close glossary  
  124.   end if
  125.     
  126.   cursor 4
  127.   
  128.   set the randomSeed = the ticks
  129.   
  130.   set gSS = 1 
  131.   set showNameP = 1
  132.   set the mouseDownScript = "endScreenSaver"
  133.   
  134.   set BigList = value(field "o.dir")
  135.   set listLen = count(BigList)
  136.   set listIndex = 1
  137.   set whichOne = random(listLen)
  138.   
  139.   hideAll48
  140.   set shuffleList = [1]
  141.   
  142.   repeat with i = 2 to listLen
  143.     set pos = random(i-1)
  144.     setAt(shuffleList, i, getAt(shuffleList, pos))
  145.     setAt(shuffleList, pos, i)
  146.   end repeat  
  147.   
  148.   repeat with i = 1 to listLen
  149.     set j = random(listLen)
  150.     set temp = getAt(shuffleList, i)
  151.     setAt(shuffleList, i, getAt(shuffleList, j))
  152.     setAt(shuffleList, j, temp)
  153.   end repeat
  154.   
  155.   
  156.   set the visibility of sprite 1 = 1
  157.   go to label("black frame")
  158.   cursor -1
  159.   
  160.   repeat while gSS      
  161.     
  162.     if the optionDown or (the machineType = 256 and the shiftDown and the controlDown) then
  163.       if whichOne = listLen then 
  164.         set whichOne = 1  
  165.       else
  166.         set whichOne = whichOne + 1
  167.       end if
  168.       
  169.     else
  170.       if listIndex = listLen then
  171.         set listIndex = 1
  172.       else
  173.         set listIndex = listIndex + 1
  174.       end if
  175.       
  176.       set whichOne = getAt(shuffleList, listIndex)
  177.     end if
  178.     
  179.     set imageName = getPropAt(BigList, WhichOne)
  180.     set info = getProp(BigList, imageName)
  181.     set mov = getAt(info, 2)
  182.     
  183.     set imageName = string(imageName)
  184.     
  185.     if the movie <> mov then 
  186.       go to movie mov
  187.       hideAll48
  188.       if showNameP then showName
  189.       set the visibility of sprite 1 = 1
  190.     end if
  191.     
  192.     go to frame imageName
  193.     go to the frame + 1
  194.     addToRetrace(imageName)
  195.     
  196.     cursor -1
  197.     
  198.     set t = (the ticks) + 300
  199.     repeat while t > the ticks
  200.       if the shiftDown then exit repeat
  201.       
  202.       if the controlDown then 
  203.         toggleName
  204.         updateStage
  205.         repeat while the controlDown
  206.         end repeat
  207.         
  208.         set showNameP = not showNameP
  209.         
  210.       end if
  211.       
  212.       if the mouseDown then 
  213.         set gSS = 0
  214.         set the mouseDownScript = empty
  215.         exit repeat
  216.       end if
  217.       
  218.     end repeat
  219.     
  220.     go to the frame - 1
  221.     
  222.     --if i = 10 then exit repeat
  223.     
  224.     
  225.   end repeat
  226.   
  227.   set gCom = 0
  228.   
  229.   goGo("TOCM", 1) -- don't add to retrace... it's already done
  230.   
  231.   --put ">>>done."
  232.   
  233. end ScreenSaver
  234.  
  235. on endScreenSaver
  236.   global gSS
  237.   set the mouseDownScript = empty
  238.   set gSS = 0
  239. end endScreenSaver
  240. --
  241. --
  242. -- Check that all celestial images begin with a proper label,
  243. -- that the initial label has no image in channel 1, and that
  244. -- the next frame has an image in channel 1 with a name that
  245. -- matches the frame label.
  246. --
  247. on CheckImages startNum
  248.   
  249.   if voidP(startNum) then set startNum = 1
  250.   
  251.   set BigList = value(field "o.dir")
  252.   
  253.   hideAll48
  254.   set the visibility of sprite 1 = 1
  255.   
  256.   repeat with i = startNum to count(BigList)
  257.     
  258.     set imageName = getPropAt(BigList, i)
  259.     set info = getProp(BigList, imageName)
  260.     set mov = getAt(info, 2)
  261.     
  262.     set imageName = string(imageName)
  263.     put imageName && mov
  264.     
  265.     if the movie <> mov then 
  266.       --put ">>> Image #" & i
  267.       go to movie mov
  268.       hideAll48
  269.       set the visibility of sprite 1 = 1
  270.     end if
  271.     
  272.     go to frame imageName
  273.     
  274.     if the castNum of sprite 1 <> 0 then 
  275.       Alert "Label" && imageName && "of movie" && mov && "is not blank"
  276.       exit repeat
  277.     end if
  278.     
  279.     go to the frame + 1
  280.     
  281.     if (the name of cast (the castNum of sprite 1)) <> (imageName & ".PIC") then
  282.       Alert imageName && "of movie" && mov && "is not present or not the same."
  283.       exit repeat
  284.     end if
  285.     
  286.     
  287.     
  288.     go to the frame - 1
  289.     
  290.     --if i = 10 then exit repeat
  291.     
  292.   end repeat
  293.   
  294.   
  295.   put "done."
  296.   
  297. end CheckImages
  298.  
  299.  
  300. on FindScrollScope
  301.   global gFile
  302.   
  303.   if not voidP(gFile) then gFile(mDispose)
  304.   
  305.   set gFile = fileIO(mNew, "write", the moviePath & "scroll and scope list")
  306.   
  307.   set movieList = getAllMovieNames() 
  308.   
  309.   repeat with i = 1 to count(movieList)
  310.     
  311.     set mov = getAt(movieList, i)
  312.     
  313.     put "Movie: " & mov
  314.     
  315.     go to movie mov
  316.     
  317.     findSS
  318.     
  319.     --put "  "
  320.     --put "  "
  321.     
  322.     
  323.   end repeat
  324.   
  325.   gFile(mDispose)
  326.   
  327.   put "done."
  328.   
  329. end FindScrollScope
  330.  
  331. on findSS
  332.   global gFile
  333.   
  334.   set count = 0
  335.   
  336.   repeat with i = 1 to 1000
  337.     
  338.     set n = the name of cast i
  339.     
  340.     if n = "SCROLL.PIC" then
  341.       set rp = the regPoint of cast i
  342.       
  343.       erase cast i
  344.       
  345.       importFileInto cast i, "Invisible Universe CD:FIXES FROM PAUL:SCROLL.PIC"
  346.       
  347.       set the regPoint of cast i = rp
  348.       
  349.       set ri = findEmpty(cast i)
  350.       importFileInto cast ri, "Invisible Universe CD:FIXES FROM PAUL:SCROLLR.PIC"
  351.       set the regPoint of cast ri = rp
  352.       
  353.       put n && the name of cast i
  354.     end if
  355.     
  356.     if n = "SCOPE.PIC" then
  357.       set rp = the regPoint of cast i
  358.       
  359.       erase cast i
  360.       
  361.       importFileInto cast i, "Invisible Universe CD:FIXES FROM PAUL:SCOPE.PIC"
  362.       
  363.       set the regPoint of cast i = rp
  364.       
  365.       set ri = findEmpty(cast i)
  366.       importFileInto cast ri, "Invisible Universe CD:FIXES FROM PAUL:SCOPER.PIC"
  367.       set the regPoint of cast ri = rp
  368.       
  369.       put n && the name of cast i
  370.     end if
  371.     
  372.     
  373.     
  374.   end repeat
  375. end findSS
  376.  
  377.  
  378. on ListTextCasts
  379.   global gFile
  380.   
  381.   if not voidP(gFile) then gFile(mDispose)
  382.   
  383.   set gFile = fileIO(mNew, "write", the moviePath & "TextCast Sprite 8")
  384.   
  385.   set movieList = getAllMovieNames() 
  386.   
  387.   repeat with i = 1 to count(movieList)
  388.     
  389.     set mov = getAt(movieList, i)
  390.     
  391.     if char 1 of mov <> "O" then next repeat
  392.     
  393.     put "Movie: " & mov
  394.     
  395.     go to movie mov
  396.     
  397.     checkSprite8
  398.     
  399.     --put "  "
  400.     --put "  "
  401.     
  402.     
  403.   end repeat
  404.   
  405.   gFile(mDispose)
  406.   
  407.   put "done."
  408.   
  409. end ListTextCasts
  410.  
  411. on checkSprite8
  412.   global gFile
  413.   repeat with i = 1 to the lastFrame 
  414.     go to frame i  
  415.     set cn = the castNum of sprite 8
  416.     if cn <> 0 then
  417.       gFile(mWriteString, cn & "," & the movie && i & "-" & 8 & RETURN)      
  418.     end if
  419.     
  420.     repeat with j = 12 to 21
  421.       set cn = the castNum of sprite j
  422.       if cn = 0 then next repeat
  423.       
  424.       set ty = the castType of cast (the castNum of sprite j)
  425.       if ty <> #text then next repeat
  426.       
  427.       gFile(mWriteString, cn & "," & the movie && i & "-" & j & RETURN)      
  428.     end repeat
  429.     
  430.   end repeat  
  431. end checkSprite8
  432.  
  433.  
  434.  
  435.  
  436. on ListLinkedCast
  437.   global gFile
  438.   
  439.   if not voidP(gFile) then gFile(mDispose)
  440.   
  441.   set gFile = fileIO(mNew, "write", the moviePath & "Linked Cast List")
  442.   
  443.   set movieList = getAllMovieNames() 
  444.   
  445.   repeat with i = 1 to count(movieList)
  446.     
  447.     set mov = getAt(movieList, i)
  448.     
  449.     put "Movie: " & mov
  450.     
  451.     go to movie mov
  452.     
  453.     showLinkedCast
  454.     
  455.     --put "  "
  456.     --put "  "
  457.     
  458.     
  459.   end repeat
  460.   
  461.   gFile(mDispose)
  462.   
  463.   put "done."
  464.   
  465. end ListLinkedCast
  466.  
  467.  
  468.  
  469. on showLinkedCast
  470.   global gFile
  471.   
  472.   set count = 0
  473.   
  474.   repeat with i = 1 to 1000
  475.     set fn = the fileName of cast i
  476.     if fn <> "" then 
  477.       --if the castType of cast i <> #bitmap then next repeat
  478.       
  479.       set fileHandle = fileIo(mNew, "read", fn)
  480.       set len = fileHandle(mGetLength)
  481.       fileHandle(mDispose)
  482.       
  483.       gFile(mWriteString, fn & "," & len & "," & i & "," & the movie & RETURN)
  484.       
  485.       --      put fn & "," & i & "," & the movie
  486.       
  487.       --      set count = count + 1
  488.       --      if count = 10 then exit
  489.     end if    
  490.   end repeat
  491. end showLinkedCast
  492.  
  493.  
  494. on getAllMovieNames 
  495.   set movieList to []
  496.   
  497.   repeat with i = 1 to 1023
  498.     set bob to getNthFileNameInFolder(the pathname,i)
  499.     if bob = "" then exit repeat
  500.     
  501.     if bob = "Shared.Dir" then next repeat
  502.     if char(length(bob)-3) to length(bob) of bob <> ".DIR" then next repeat
  503.     add movieList,bob
  504.     
  505.   end repeat
  506.   
  507.   
  508.   return movieList
  509. end
  510.  
  511.  
  512.  
  513. --
  514. --
  515. -- Test code for substituting cast members
  516. --
  517. on substCast
  518.   
  519.   repeat with i = 1 to 1
  520.     set listCast = the number of cast ("sort l" & i)
  521.     
  522.     set count = the number of lines in field listCast
  523.     
  524.     repeat with j = 1 to count
  525.       
  526.       if char 1 of line j of field listCast <> "I" then next repeat
  527.       
  528.       set fn = item 1 of line j of field listCast
  529.       set sz = integer(item 2 of line j of field listCast)
  530.       set cn = integer(item 3 of line j of field listCast)
  531.       set mv = item 4 of line j of field listCast
  532.       
  533.       --      set fn2 = item 1 of line (j+1) of field listCast
  534.       --      set sz2 = integer(item 2 of line (j+1) of field listCast)
  535.       --      
  536.       --      if (fn = fn2) and (sz = sz2) then 
  537.       --        put "Dup: " & fn
  538.       --        next repeat  
  539.       --      end if
  540.       
  541.       --if sz > 6000 then next repeat
  542.       
  543.       if the movie <> mv then 
  544.         --put ">>> Saving old movie (" & the movie & ")"
  545.         saveMovie
  546.         --put ">>> Opening new movie (" & mv & ")"
  547.         go to Movie mv
  548.         --asdf
  549.       end if
  550.       
  551.       put fn && sz && cn && mv
  552.       
  553.       set rp = the regPoint of cast cn
  554.       
  555.       erase cast cn
  556.       
  557.       importFileInto cast cn, fn
  558.       
  559.       set the regPoint of cast cn = rp
  560.       
  561.       put ">" before char 1 of line j of field listCast
  562.       
  563.       put the freeBytes
  564.       
  565.       if the freeBytes < 1500000 then
  566.         saveMovie
  567.         unloadCast 1,1000
  568.       end if
  569.       
  570.       if the freeBytes < 1000000 then asdf
  571.       
  572.     end repeat
  573.   end repeat
  574.   
  575.   put "done."
  576. end substCast
  577.  
  578.  
  579. --
  580. --
  581. -- Test code for deleting files in a list
  582. --
  583. on delFile
  584.   
  585.   repeat with i = 1 to 1
  586.     set listCast = the number of cast ("sort l" & i)
  587.     
  588.     set count = the number of lines in field listCast
  589.     
  590.     repeat with j = 1 to count
  591.       
  592.       if char 1 of line j of field listCast <> ">" then next repeat
  593.       
  594.       set fn = item 1 of line j of field listCast
  595.       set fn = char 2 to length(fn) of fn
  596.       
  597.       set sz = integer(item 2 of line j of field listCast)
  598.       set cn = integer(item 3 of line j of field listCast)
  599.       set mv = item 4 of line j of field listCast
  600.       
  601.       set fileHandle = fileIo(mNew, "read", fn)
  602.       if not objectP(fileHandle) then next repeat
  603.       
  604.       fileHandle(mDelete)
  605.       
  606.       put "Deleted: " & fn 
  607.       
  608.       put "+" before char 1 of line j of field listCast
  609.       
  610.     end repeat
  611.   end repeat
  612.   
  613. end delFile
  614.  
  615.  
  616. --
  617. --
  618. -- Test code for substituting cast members
  619. --
  620. on remLinesFile
  621.   
  622.   repeat with i = 1 to 4
  623.     set listCast = the number of cast ("sort l" & i)
  624.     put "Checking Cast" & listCast
  625.     
  626.     set count = the number of lines in field listCast
  627.     
  628.     repeat with j = count down to 1
  629.       
  630.       if char 1 of line j of field listCast = "I" then next repeat
  631.       
  632.       delete line j of field listCast
  633.       
  634.     end repeat
  635.   end repeat
  636.   
  637.   put "Done."
  638.   
  639. end remLinesFile
  640.  
  641.  
  642. --
  643. --
  644. -- code to copy cast 1-89 with names of the destination in the shared cast
  645. --
  646. on MoveNewText
  647.   repeat with i = 1 to 89
  648.     set num = integer(the name of cast i)
  649.     set name = the name of cast num
  650.     put num && name
  651.     
  652.     copyToClipBoard cast i
  653.     pasteClipBoardInto cast (num)
  654.     set the name of cast (num) = name
  655.     -- if i = 10 then asdf
  656.     
  657.   end repeat
  658.   
  659. end MoveNewText
  660.  
  661.  
  662. on dropPunct str
  663.   global gPunctuation
  664.   
  665.   set c = length(str)
  666.   repeat with i = 1 to c
  667.     if gPunctuation contains char c of str then
  668.       set c = c - 1  
  669.     else 
  670.       return char 1 to c of str
  671.     end if
  672.     
  673.   end repeat
  674.   
  675.   return char 1 to c of str
  676.   
  677. end
  678.  
  679. on cleanTextCastScripts
  680.   
  681.   set j = 0
  682.   
  683.   repeat with i = 2000 to 3002
  684.     if the name of cast i = 0 then
  685.       set the scriptText of cast i = ""      
  686.       --put ">>>> changed cast " & i
  687.       
  688.       if the castType of cast i = #text then
  689.         if (the text of field i) = "" then erase cast i
  690.       end if
  691.       
  692.     end if
  693.     
  694.     put the freeBytes
  695.     
  696.     if the freeBytes < 1500000 then
  697.       saveMovie
  698.       unloadCast 1,1000
  699.     end if
  700.     
  701.     set j = j + 1
  702.     if j = 100 then
  703.       beep
  704.       set j = 0
  705.     end if
  706.     
  707.   end repeat
  708.   
  709.   put "Done."
  710.   
  711. end cleanTextCastScripts
  712.  
  713.  
  714. on setTextCastScripts
  715.   
  716.   set j = 0
  717.   
  718.   repeat with i = 2000 to 3002
  719.     if the castType of cast i = #Text then
  720.       set the scriptText of cast i = "on mouseDown" & return & "  doTextClick(" & i & ")" & return & "end"
  721.       
  722.     end if
  723.     
  724.     put the freeBytes
  725.     
  726.     if the freeBytes < 1500000 then
  727.       saveMovie
  728.       unloadCast 1,1000
  729.       if the machineType <> 256 then maxmem() 
  730.     end if
  731.     
  732.     set j = j + 1
  733.     if j = 100 then
  734.       beep
  735.       set j = 0
  736.     end if
  737.     
  738.     
  739.   end repeat
  740.   
  741.   put "Done."
  742.   
  743. end setTextCastScripts
  744.  
  745. on findBold fileName
  746.   findStyle "bold", fileName, 2135, 3002
  747. end
  748.  
  749. on findUnderlineText mc, cn
  750.   global gPunctuation
  751.   
  752.   set thePhrase = char mc of field cn
  753.   
  754.   set i = mc - 1 
  755.   
  756.   repeat while i > 0
  757.     if (the textStyle of char i of field cn) <> "underline" then exit repeat
  758.     set thePhrase = char i of field cn & thePhrase
  759.     set i = i - 1
  760.   end repeat
  761.   
  762.   set i = mc + 1 
  763.   set last = the number of chars of field cn
  764.   
  765.   repeat while i <= last
  766.     if (the textStyle of char i of field cn) <> "underline" then exit repeat
  767.     set thePhrase = thePhrase & char i of field cn 
  768.     set i = i + 1
  769.   end repeat
  770.   
  771.   set l = the number of chars in thePhrase
  772.   
  773.   repeat while gPunctuation contains (char l of thePhrase)
  774.     set l = l - 1
  775.     if l = 0 then
  776.       alert "Note that char " & mc && "of cast" && cn && "is only punctuation."
  777.       put "*** Note that char " & mc && "of cast" && cn && "is only punctuation."
  778.       put quote & char (mc - 4) to (mc + 4) of field cn & quote
  779.       asdf
  780.     end if
  781.   end repeat
  782.   
  783.   if l = 1 then
  784.     put "*** Single char phrase at char " & mc & " in cast " & cn  
  785.   end if
  786.   
  787.   
  788.   set thePhrase = char 1 to l of thePhrase
  789.   
  790.   return thePhrase
  791.   
  792. end findUnderlineText
  793.  
  794. on findUnderline fileName
  795.   findStyle2 "underline", fileName, 2254,2254 --2000, 3002
  796. end
  797.  
  798.  
  799. on findStyle2 style, fileName, startN, endN
  800.   global gPunctuation, gUnderlineCount
  801.   global fh
  802.   
  803.   set gUnderlineCount = length(field "Underline List")
  804.   
  805.   put "Looking for words that are: " & style
  806.   
  807.   set gPunctuation = ":,.;)(" & quote & " " & return
  808.   
  809.   if objectP(fh) then fh(mDispose)
  810.   
  811.   set fh = fileIO(mNew, "write", the moviePath & fileName)
  812.   
  813.   repeat with i = startN to endN
  814.     set num = the number of chars in field i
  815.     set printedCast = 0
  816.     
  817.     set c = 1
  818.     
  819.     repeat while c < num
  820.       if the textStyle of char c of field i contains style then
  821.         if the textStyle of char c of field i contains "," then
  822.           put "**** cast " & i & " contains mixed styles"
  823.           alert "**** cast " & i & " contains mixed styles"
  824.           asdf
  825.         end if
  826.         
  827.         if not printedCast then
  828.           set printedCast = 1
  829.           put "Cast:" && i
  830.         end if
  831.         
  832.         set thePhrase = findUnderlineText(c, i)
  833.         set c = c + the number of chars in thePhrase
  834.         
  835.         set mapsTo = underLineLookUp(thePhrase, i)  
  836.         
  837.         if mapsTo = 0 then
  838.           set glossLoc = " *** unknown phrase"
  839.         else
  840.           set glossLoc = " -> " & the name of cast mapsTo && "cast " & mapsTo
  841.         end if
  842.         
  843.         fh(mWriteString, ¼
  844. thePhrase & "---- cast " & i & "  " & the name of cast i  & glossLoc & RETURN)  
  845.         
  846.       end if
  847.       
  848.       set c = c + 1
  849.       
  850.     end repeat
  851.     
  852.     --if i = (startN + 20) then exit repeat
  853.     
  854.   end repeat
  855.   
  856.   fh(mDispose)
  857.   
  858.   put "done."
  859. end
  860.  
  861. on underLineLookUp thePhrase, cn
  862.   global gUnderlineCount
  863.   --
  864.   --
  865.   -- Find the start of the phrase, find the ">", look to see if there
  866.   -- is a "," after the 4-digit cast number, if so check for a match
  867.   -- on the text that was clicked, otherwise match.
  868.   --
  869.   
  870.   set off = 0
  871.   
  872.   repeat while 1
  873.     set off = offset(thePhrase, (char off to gUnderlineCount of field "Underline List"))
  874.     --put char off to off+length(thePhrase)-1 of field "underline list"
  875.     
  876.     if off = 0 then return 0
  877.     
  878.     set off2 = offset(">", char off to gUnderlineCount of field "Underline List")
  879.     
  880.     if off2 = 0 then return 0
  881.     
  882.     set off = off + off2
  883.     
  884.     
  885.     if (char (off+4) of field "Underline List") = "," then
  886.       set matchCast = integer(char (off+5) to (off+8) of field "Underline List")
  887.       if cn <> matchCast then next repeat
  888.     end if
  889.     
  890.     return integer(char (off) to (off+3) of field "Underline List")
  891.     
  892.   end repeat
  893.   
  894.   
  895. end underLineLookUp
  896.  
  897. on findStyle style, fileName, startN, endN
  898.   global gPunctuation
  899.   put "Looking for words that are: " & style
  900.   
  901.   set gPunctuation = ":,.;)(" & quote & " " & return
  902.   
  903.   
  904.   set fh = fileIO(mNew, "write", the moviePath & fileName)
  905.   
  906.   repeat with i = startN to endN
  907.     set num = the number of words in field i
  908.     set firstOne = -1
  909.     set printedCast = 0
  910.     
  911.     repeat with w = 1 to num
  912.       if the textStyle of word w of field i contains style then
  913.         if firstOne = -1 then 
  914.           set firstOne = w
  915.           --put "first one = " & w  
  916.         end if
  917.       else
  918.         if firstOne > -1 then
  919.           if not printedCast then
  920.             set printedCast = 1
  921.             put "Cast:" && i
  922.           end if
  923.           
  924.           put word firstOne to (w - 1) of field i into phrase
  925.           
  926.           --put "Last one = " & (w - 1)
  927.           
  928.           set phrase = dropPunct(phrase)
  929.           
  930.           --if not (the text of field castN contains phrase) then
  931.           --put phrase & "---- cast " & i & RETURN after field castN 
  932.           fh(mWriteString, phrase & "---- cast " & i & "  " & the name of cast i & RETURN)
  933.           --end if
  934.           
  935.           set firstOne = -1  
  936.         end if
  937.       end if
  938.       
  939.     end repeat
  940.     
  941.     if firstOne > -1 then 
  942.       if not printedCast then
  943.         set printedCast = 1
  944.         put "Cast:" && i
  945.       end if
  946.       
  947.       put word firstOne to (w - 1) of field i into phrase
  948.       
  949.       --put "Last one = " & (w - 1)
  950.       
  951.       set phrase = dropPunct(phrase)
  952.       
  953.       --if not (the text of field castN contains phrase) then
  954.       --          put phrase & "---- cast " & i & RETURN after field castN 
  955.       fh(mWriteString, phrase & "---- cast " & i & "  " & the name of cast i & RETURN)      
  956.       --end if
  957.       
  958.     end if
  959.     
  960.   end repeat
  961.   
  962.   fh(mDispose)
  963.   
  964.   put "done."
  965. end
  966.  
  967.  
  968. on MemoryWaterMark str
  969.   global gMemFree
  970.   
  971.   set a = gMemFree
  972.   set gMemFree = the freeBytes
  973.   --put ">>>" & str && gMemFree && gMemFree / 1024 & "k" && (a - gMemFree) && (a - gMemFree)/1024 & "k"
  974. end MemoryWaterMark
  975.  
  976.  
  977. on compilePropertyList
  978.   set cn = the number of cast "property list"
  979.   repeat with i = 64 to 67
  980.     put i
  981.     
  982.     set name = item 5 of line i of field cn
  983.     set num = the number of cast name
  984.     if num = -1 then asdf
  985.     put num into item 5 of line i of field cn
  986.     
  987.     set name = item 6 of line i of field cn
  988.     set num = the number of cast name
  989.     if num = -1 then asdf
  990.     put num into item 6 of line i of field cn 
  991.   end repeat
  992.   
  993.   
  994. end compilePropertyList
  995.  
  996.  
  997. on lineItem s
  998.   if voidP(s) then set s = 1
  999.   set f = the number of cast "property list"
  1000.   set n = the number of lines in field f
  1001.   repeat with i = s to n
  1002.     put i into item 1 of line i of field f
  1003.     
  1004.   end repeat  
  1005. end lineItem
  1006.  
  1007.  
  1008. on setSpaces15
  1009.   
  1010.   set k = 0
  1011.   
  1012.   --  repeat with i = 2135 to 3002
  1013.   repeat with i = 2925 to 3002
  1014.     set c = the number of chars in field i
  1015.     repeat with j = 1 to c
  1016.       if char j of field i = " " then 
  1017.         set the textSize of char j of field i = 15  
  1018.         --put ">>> set char to5"
  1019.       end if
  1020.       
  1021.     end repeat
  1022.     
  1023.     put the freeBytes
  1024.     
  1025.     if the freeBytes < 1500000 then
  1026.       saveMovie
  1027.       unloadCast 1,1000
  1028.     end if
  1029.     
  1030.     set k = k + 1
  1031.     put i
  1032.     
  1033.     --if k = 2 then asdf
  1034.   end repeat
  1035.   
  1036.   put "Done."
  1037.   
  1038. end setSpaces15
  1039.  
  1040. on testEmptyCast fir, las
  1041.   repeat with i = fir to las 
  1042.     if the castType of cast i <> #text then
  1043.       put "Cast " & i
  1044.       exit
  1045.     end if
  1046.   end repeat
  1047.   
  1048.   put "Done."
  1049.   
  1050. end testEmptyCast
  1051.  
  1052.  
  1053. on keyDown
  1054.   checkKeyDowns
  1055. end keyDown
  1056.  
  1057. on checkKeyDowns
  1058.   global gFindString, gFindStringPos
  1059.   
  1060.   --beep
  1061.   
  1062.   if (the machineType = 256 and the controlDown) or the commandDown then
  1063.     if (the key = "q") then doQuit  
  1064.     if (the key = "f") then doFind
  1065.     if (the key = "h") then doHelp
  1066.     if (the key = "g") then doGlossary
  1067.     exit
  1068.   end if
  1069.   
  1070.   --put ">>>the key = " && the key && the keyCode
  1071.   
  1072.   dontPassEvent  
  1073.   
  1074. end checkKeyDowns
  1075.  
  1076.